@echo off
if not exist "..\ga_sa\mpi\Release\rastrigin_ga_sa_mpi.exe" (echo ERROR: ..\ga_sa\mpi\Release\rastrigin_ga_sa_mpi.exe not found
echo Please build project rastrigin_ga_sa_mpi
goto :eof
)

for %%R in (1 2 3 4 5) do for %%G in (1 2 3 4) do (call :run %%R %%G easom)
goto :eof

:run
echo randseed: %1, cpu: %2
if not exist "..\res\%3\%1" @mkdir "..\res\%3\%1"
if exist "..\res\%3\%1\%2.ga_sa.mpi.txt" del "..\res\%3\%1\%2.ga_sa.mpi.txt"
"C:\MPICH2\bin\mpiexec.exe" -localonly -machinefile "..\..\..\logins\hosts.txt" -np %2 "..\ga_sa\mpi\Release\rastrigin_ga_sa_mpi.exe" %1 ga_sa_%3.xml > "..\res\%3\%1\%2.ga_sa.mpi.txt"